var nodemailer = require('nodemailer');
const YAML = require('yamljs')
const fs = require('fs')
const { mail } = YAML.parse(fs.readFileSync('./server/config.yaml').toString());
var transporter = nodemailer.createTransport({
    //https://github.com/andris9/nodemailer-wellknown#supported-services 支持列表
    service: 'qq',
    port: 465, // SMTP 端口
    secureConnection: true, // 使用 SSL
    auth: {
        user: mail.user,
        //这里密码不是qq密码，是你设置的smtp密码
        pass: mail.pass
    }
});

// NB! No need to recreate the transporter object. You can use
// the same transporter object for all e-mails

// setup e-mail data with unicode symbols

function send(html) {
    return '';
    let mailOptions = {
        from: mail.user, // 发件地址
        to: 'lsdfly@qq.com', // 收件列表
        subject: 'godebug 日志打印', // 标题
        //text和html两者只支持一种
        text: 'Hello world ?', // 标题
        html: html // html 内容
    };
    transporter.sendMail(mailOptions, function(error, info) {
        if (error) {
            return console.log(error);
        }
        console.log('Message sent: ' + info.response);

    })
}
export default {
    send: send
}